package com.gzl.b2b.demo.controller;

import com.gzl.b2b.demo.entity.User;
import com.gzl.b2b.demo.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * es demo Controller
 *
 * @version 1.0, 2019/4/12
 */
@RestController
@RequestMapping("user")
public class UserController {

    @Autowired
    private UserService userService;

    @GetMapping("/demo")
    public String demo() {
        return "demo";
    }


    @PostMapping("/add")
    public boolean add(@RequestBody User user) {
        return userService.insert(user);
    }

    @GetMapping("/findById")
    public User findById(String id) {
        return userService.findById(Long.parseLong(id));
    }


}
